package edu.zut.oop_test.test4;

public class ScenicOperation {

    /**
     * 根据游客的年龄计算景区价钱
     */
    public static double calPrice(ScenicSpot spot,Tourists tourists){
        int age = tourists.age;
        if (age < 16){
            return spot.price * 0.8;
        }else if (age >= 60){
            return spot.price * 0.6;
        }else {
            return spot.price;
        }
    }


    public static void main(String[] args) {
        ScenicSpot spot = new ScenicSpot();
        spot.name = "清明上河园";
        spot.level = "5A";
        spot.price = 200;
        Tourists tourists = new Tourists();
        tourists.idCard = "216456456";
        tourists.name = "张三";
        tourists.age = 75;

        double price = ScenicOperation.calPrice(spot, tourists);
        System.out.println("price = " + price);

    }

}
